remove comma from last element of an array